/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package lesson3.com.demo.ser;


public class Dog extends Animal implements java.io.Serializable{
    private int age;
    private String name;
    private double weight;
    private int shadowedLegCount;
    private transient Thread tongueLapperThread;
    
    public Dog(){
        super(4);
        shadowedLegCount = super.getLegCount();
        System.out.println("Constructor for dog called");
    }
    
    public void bark(){
        System.out.println("Woof");
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }
    
    @Override
    public int getLegCount(){
        if(super.getLegCount()!=shadowedLegCount){
            super.setLegCount(shadowedLegCount);
        }
        return super.getLegCount();
    }

    @Override
    public String toString() {
        return "Dog{legCount="+ getLegCount()+", age=" + age + ", name=" + name + ", weight=" + weight + '}';
    }
    
    
}
